﻿
@{
    ViewBag.Title = "用户中心";
    Layout = "~/Views/Shared/_Layout_BBS.cshtml";
    UserInfo user = ViewBag.User;
    if (user != null && user.Avatar.IsNullOrEmpty())
    {
        user.Avatar =PubMethod.GetDefaultAvatar(Url.Content("~/"),user.Avatar);
    }
}
@model IndexResult
@using SyntacticSugar
@using Infrastructure.DbModel
@using Infrastructure.Pub
@using Infrastructure.ViewModels.UserCenter
@section js{
     <script>
         layui.define(['ejq', 'layer'], function (exports) {
             var $ = layui.ejq;
             var layer = layui.layer;
             var adelete = $(".fly-delete");
             var pmsNew = $(".pms-new");
             adelete.click(function () {
                 var th = $(this);
                 var id = th.data("id");
                 $.ajax({
                     url: $.action.urlContent("UserCenter/DeletePmsById"),
                     data: { id: id },
                     cache:false,
                     success: function (msg) {
                         th.closest(".pms-box").remove();
                     }, error: function (msg) {
                         layer.msg("删除失败！");
                     }
                 });
             })
             if (pmsNew.size() > 0) {
                 $.ajax({
                     url: $.action.urlContent("UserCenter/ClearPmsNew"),
                     cache: false,
                     success: function (msg) {
                         th.closest(".pms-box").remove();
                     }, error: function (msg) {

                     }
                 });
             }
         });
     </script>
}
<div class="main layui-clear">
    <h2 class="page-title">用心中心</h2>
    <div class="wrap">
        <div class="content">
            <div class="fly-msg">
                @if (user == null || user.Email.IsNullOrEmpty())
                {
                    @: 您的邮箱尚未验证，激活后别人回复了您的贴子我们会发邮件提醒你哦，
                    <a href="~/UserCenter/ActivateMail">立即去激活？</a>
                }
                else
                {
                    @:你的邮箱 @user.Email 已经激活
                }
            </div>
            <div class="fly-tab user-tab">
                <span id="LAY-mine">
                    <a class="tab-this" href="/UserCenter">我的主页</a>
                    <a href="/UserCenter/ChangeAvatar">修改头像</a>
                </span>
            </div>
            <div class="user-mine">
                <ul class="mine-view jie-row" style="display: block;">
                    @if (Model.PmsListNew.IsValuable())
                    {
                    
                            foreach (var item in Model.PmsListNew)
                            {
                                <div class="pms-box">
                                    <ul class="mine-msg">
                                        <li data-id="19367">
                                            <div msg="">
                                                @item.Subject 
                                                @if (item.New == 1)
                                                {
                                                <font class="pms-new" color="#f60">【新】</font>
                                                }
                                                <br />
                                                <i style="color:#999">附加消息：</i>
                                                @Html.Raw(item.Message)
                                            </div>
                                            <p style="width:150px;float:right">
                                                <span>@DateSugar.DateStringFromNow(item.Postdatetime.TryToDate().ToLocalTime())</span><a href="javascript:;" data-id="@item.Pmid" class="layui-btn layui-btn-small fly-delete">删除</a>
                                            </p>
                                        </li>
                                    </ul>
                                </div>
                            }

                    }
                    else
                    {
                        <div class="fly-msg">
                            没有相关数据
                        </div>
                     }
                </ul>
            </div>
            <div id="LAY-page"></div>
        </div>
    </div>
    <div class="edge">
        <div class="user-about">
            <a href="~/UserCenter" title="修改头像"> <img class="user-avatar" src="@user.Avatar" /> </a>
            <p> <span style="color:#333">@user.NickName</span> </p>
            <p> <span>加入时间：@user.CreateTime.TryToDate().ToString("yyyy-MM-dd")</span> <span> 飞吻： <em style="color:#FF7200">100</em> </span> </p>
            <p> <span>城市：</span> <span> 性别：  </span> </p>
            <p> <span></span> </p>
            <div class="user-looklog" style="padding-bottom:200px;">
                <h3>最近访客</h3>
                <span>
                    @if (Model.VList.IsValuable())
                    {
                        foreach (var item in Model.VList)
                        {
                            if (item.VisAvatar.IsNullOrEmpty())
                            {
                                item.VisAvatar = Url.Content("~/_theme/default.jpg");
                            }
                            <a href="~/UserCenter/PublicInfo?id=@item.VisitorId">
                                <img src="@item.VisAvatar" />
                                <cite>@item.VisName</cite> <i>@DateSugar.DateStringFromNow(item.CreateDate.ToLocalTime())</i>
                            </a>
                        }
                    }
                    else
                    {
                        <div class="fly-msg">
                            没有相关数据
                        </div>
                    }
                </span>
            </div>
        </div>
    </div>
</div>
